<template>
  <div class="hot">
    <div class="title">
      <i class="icon-huangguan iconfont"></i>
      <h3>{{ title }}</h3>
    </div>
    <div class="slide">
      <ul class="hot_pro">
        <li
          class="hot_pro_item"
          v-for="item in hotlst"
          :key="item.id"
          @click="toDetails(item.id)"
        >
          <div class="img">
            <img :src="item.photo" alt="" />
          </div>
          <p class="ellipsis-2">
            {{ item.title }}
          </p>
          <div class="bot">
            <span class="price">￥ {{ item.sell_price }}</span>
            <span class="see icon-chakan iconfont"></span>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import BetterScroll from "@better-scroll/core";
export default {
  name: "hot",
  data() {
    return {};
  },
  methods: {
    toDetails(id) {
      // console.log(id);
      this.$router.push(`/details/${id}`);
    },
  },
  mounted() {
    this.bs = new BetterScroll(".slide", {
      scrollX: true,
      probeType: 3,
      eventPassthrough: "vertical",
    });
  },
  props: {
    hotlst: Array,
    title: String,
  },
  updated() {
    this.$nextTick(() => {
      this.bs.refresh();
    });
  },
};
</script>

<style lang="less">
.hot {
  margin-top: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 0px 40px 16px;
  background-color: #08dbdb;
  .title {
    display: flex;
    i {
      font-weight: bold;
      font-size: 30px;
      line-height: 36px;
      padding: 14px 0;
      color: #fff;
    }
    h3 {
      font-weight: bold;
      font-size: 28px;
      line-height: 36px;
      padding: 16px 0;
      color: #fff;
      margin-left: 14px;
    }
  }
  .slide {
    width: 670px;
    background-color: #fff;
    height: 302px;
    border-radius: 10px;
    overflow: hidden;
    .hot_pro {
      display: inline-flex;
      .hot_pro_item {
        width: 185px;
        height: 302px;
        padding: 0 18px;
        .img {
          width: 100%;
          height: 185px;
          background-color: #f79;
          img {
            width: 100%;
          }
        }
        /deep/p {
          width: 100%;
          color: #f999;
          font-size: 18px;
          line-height: 24px;
          margin-top: 8px;
          height: 48px;
        }
        .bot {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-top: 10px;
          .price {
            font-size: 18px;
            color: #f31b1b;
          }
          .see {
            margin-right: 17px;
            color: #08dbdb;
            font-size: 18px;
          }
        }
      }
    }
  }
}
</style>
